package com.stylefeng.guns.modular.system.warpper;

import java.text.DecimalFormat;
import java.util.Date;
import java.util.Map;

import com.stylefeng.guns.core.base.warpper.BaseControllerWarpper;
import com.stylefeng.guns.core.util.DateUtil;

public class CurFengKouWarpper extends BaseControllerWarpper{

	public CurFengKouWarpper(Object list) {
        super(list);
    }

    @Override
    public void warpTheMap(Map<String, Object> map) {
    	DecimalFormat df = new DecimalFormat("0.00");
    	
		Date date = ((Date)map.get("gDate"));
		map.put("gDate", DateUtil.getTime(date));
		double gZlje = ((Double)map.get("gZlje"));
		if(Math.abs(gZlje) < 100000000){
			map.put("gZlje", (gZlje / 10000) > 0 ? "<font color='red'><b>"+df.format((gZlje / 10000))+"万</b></font>" : "<font color='green'><b>"+df.format((gZlje / 10000))+"万</b></font>");
		}else{
			map.put("gZlje", (gZlje / 100000000) > 0 ? "<font color='red'><b>"+df.format((gZlje / 100000000))+"亿</b></font>" : "<font color='green'><b>"+df.format((gZlje / 100000000))+"亿</b></font>");
		}
		double gZlbuy = ((Double)map.get("gZlbuy"));
		if(Math.abs(gZlbuy) < 100000000){
			map.put("gZlbuy", (gZlbuy / 10000) > 0 ? "<font color='red'><b>"+df.format((gZlbuy / 10000))+"万</b></font>" : "<font color='green'><b>"+df.format((gZlbuy / 10000))+"万</b></font>");
		}else{
			map.put("gZlbuy", (gZlbuy / 100000000) > 0 ? "<font color='red'><b>"+df.format((gZlbuy / 100000000))+"亿</b></font>" : "<font color='green'><b>"+df.format((gZlbuy / 100000000))+"亿</b></font>");
		}
		
		double gZlshell = ((Double)map.get("gZlshell"));
		if(Math.abs(gZlshell) < 100000000){
			map.put("gZlshell", (gZlshell / 10000) > 0 ? "<font color='red'><b>"+df.format((gZlshell / 10000))+"万</b></font>" : "<font color='green'><b>"+df.format((gZlshell / 10000))+"万</b></font>");
		}else{
			map.put("gZlshell", (gZlshell / 100000000) > 0 ? "<font color='red'><b>"+df.format((gZlshell / 100000000))+"亿</b></font>" : "<font color='green'><b>"+df.format((gZlshell / 100000000))+"亿</b></font>");
		}
		
		double gRate = ((Double)map.get("gRate"));
		if(gRate > 0){
			map.put("gRate", "<font color='red'><b>"+gRate+"</b></font>");
		}else{
			map.put("gRate", "<font color='green'><b>"+gRate+"</b></font>");
		}
		
		Object gTdate = map.get("gTdate");
		if(gTdate == null){
			map.put("gTdate", "无");
			map.put("isExits", "<font color='green'><b>否</b></font>");
		}else{
			map.put("gTdate", DateUtil.getDay((Date)gTdate));
			map.put("isExits", "<font color='red'><b>是</b></font>");
		}
		
		String gTrade = ((String)map.get("gTrade"));
		map.put("gTrade","<font color='Chocolate'><b> " +gTrade+" </b></font>");
    }
    
}
